﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="dictionaryedit.aspx.cs" Inherits="StoreWeb.system.basis.dictionaryedit" %>

<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
<script type="text/javascript" src="../../lib/html5.js"></script>
<script type="text/javascript" src="../../lib/respond.min.js"></script>
<script type="text/javascript" src="../../lib/PIE_IE678.js"></script>
<![endif]-->
    <link href="../../css/H-ui.min.css" rel="stylesheet" type="text/css" />
    <link href="../../css/H-ui.admin.css" rel="stylesheet" type="text/css" />
    <link href="../../css/style.css" rel="stylesheet" type="text/css" />
    <link href="../../lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
    <link href="../../css/jquery.autocomplete.css" rel="stylesheet" />
    <!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
    <title>编辑业务档案信心</title>
</head>
<body>
    <div class="pd-20">
        <form runat="server" method="post" class="form form-horizontal" id="formmemberadd">
            <div class="row cl">
                <label class="form-label col-2"><span class="c-red">*</span>属性编码：</label>
                <div class="formControls col-6">
                    <input type="text" class="input-text" value="" placeholder="请填写属性编码" id="code" name="code" runat="server" datatype="*" nullmsg="属性编码不能为空">
                </div>
                <div class="col-4"></div>
            </div>
            <div class="row cl">
                <label class="form-label col-2"><span class="c-red">*</span>属性名称：</label>
                <div class="formControls col-6">
                    <input type="text" class="input-text" value="" placeholder="请填写属性名称" id="name" name="name" runat="server" datatype="*" nullmsg="属性名称不能为空">
                </div>
                <div class="col-4"></div>
            </div>
            <div class="row cl">
                <label class="form-label col-2"><span class="c-red">*</span>属性分类代码：</label>
                <div class="formControls col-6">
                    <input type="text" class="input-text" value="" placeholder="请填写属性分类代码" id="parentcode" name="parentcode" runat="server" datatype="*" nullmsg="属性分类代码不能为空">
                </div>
                <div class="col-4"></div>
            </div>
            <div class="row cl">
                <label class="form-label col-2"><span class="c-red">*</span>属性分类名称：</label>
                <div class="formControls col-6">
                    <input type="text" class="input-text" value="" placeholder="请填写属性分类名称" id="parentname" name="parentname" runat="server" datatype="*" nullmsg="属性分类名称不能为空">
                </div>
                <div class="col-4"></div>
            </div>
            <div class="row cl">
                <label class="form-label col-2">描述：</label>
                <div class="formControls col-6">
                    <input type="text" class="input-text" value="" placeholder="选填" id="note" name="note" runat="server">
                </div>
            </div>
            <div class="row cl">
                <div class="col-10 col-offset-2">
                    <asp:HiddenField ID="hidid" runat="server" />
                    <asp:Button ID="btnok" runat="server" CssClass="btn btn-success radius" Text="确定" />
                </div>
            </div>
        </form>
    </div>
    <script type="text/javascript" src="../../lib/jquery/1.9.1/jquery.min.js"></script>
    <script src="../../js/jquery.autocomplete.js"></script>
    <script type="text/javascript" src="../../lib/layer/1.9.3/layer.js"></script>
    <script type="text/javascript" src="../../lib/Validform/5.3.2/Validform.min.js"></script>
    <script type="text/javascript" src="../../lib/laypage/1.2/laypage.js"></script>
    <script type="text/javascript" src="../../lib/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript" src="../../js/H-ui.js"></script>
    <script type="text/javascript" src="../../js/H-ui.admin.js"></script>
    <script>
        $(function () {
            $.ajax({
                type: "POST",
                contentType: "application/json",
                url: "../../ajax/dictionary.aspx?action=getparent",
                dataType: "json",
                success: function (datas) {
                    $("#parentcode").autocomplete(datas, {
                        matchContains: true,
                        formatItem: function (row, i, max) {
                            if (row.parentcode != undefined) {
                                return "<table width='400px'><tr><td align='left'>[" + row.parentcode + "] " + row.parentname + "</td></tr></table>";
                            } else {
                                return "<table width='400px'><tr><td align='left'>没有找到相关数据！</td></tr></table>";
                            }
                        },
                        formatMatch: function (row, i, max) {
                            return row.parentcode + row.parentname;
                        }
                    }).result(function (event, data, formatted) {
                        $("#parentcode").val(data.parentcode);
                        $("#parentname").val(data.parentname);
                    });
                }
            });
            $("#formmemberadd").Validform({
                tiptype: 2,
                btnSubmit: "#btnok",
                //callback: function (form) {
                //    form[0].submit();
                //    var index = parent.layer.getFrameIndex(window.name);
                //    parent.$('.btn-refresh').click();
                //    parent.layer.close(index);
                //}
                //,
                beforeSubmit: function (curform) {
                    $.post("../../ajax/dictionary.aspx", { code: $("#code").val(), parentcode: $("#parentcode").val(), parentname: $("#parentname").val(), name: $("#name").val(), note: $("#note").val(), id: $("#hidid").val() },
                    function (data) {
                        if (data == 1) {
                            parent.layer.alert("添加成功", function () {
                                parent.location.reload();
                            });
                        } else if (data == 2) {
                            parent.layer.alert("修改成功", function () {
                                parent.location.reload();
                            });
                        } else if (data == 3) {
                            parent.layer.alert("属性编码已经存在", { icon: 2 });
                        } else {
                            parent.layer.msg("操作失败");
                        }
                    });
                    return false;
                }
            });
        });
    </script>
</body>
</html>
